package storage;

import java.util.ArrayList;
import java.util.List;

import com.google.inject.Singleton;

import net.jcip.annotations.Immutable;

@Singleton
@Immutable
public class CareTakerImpl implements CareTaker {

	private final List<Memento> mementos = new ArrayList<>();
	
	@Override
	public void add(final Memento memento) {
		mementos.add(memento);
	}
	
	
	@Override
	public Memento remove() {
		if (mementos.size() == 0) {
			return CanvasMemento.blankInstance();
		}
		return mementos.remove(mementos.size() - 1);
	}
}
